<template>
	<view class="container">
		<view v-if="expressStatus == 1">
			<view class="list_bg">
				<view class="top-sec">
					<view class="a-row">
						<view class="wl-name">{{shippingName||''}}</view>
					</view>
					<view class="a-row">
						<view class="label">物流单号：</view>
						<view class="text">{{shippingNo||''}}</view>
					</view>
				</view>
			</view>
			<view class="list_bg">
				<view class="sec-wrap">
					<view class="details-info">
						<view class="line-box"></view>
						<view class="a-row" v-for="(item, index) in expressList" :key="index">
							<view class="dot">
								<view class="active-dot" :hidden="index== 0 ? false : true">
									<view class="yuan-red"></view>
								</view>
								<view class="default-dot" :hidden="index== 0 ? true : false"></view>
							</view>
							<view class="info">
								<view class="date-box">{{item.time}}</view>
								<view class="text">{{item.status}}</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<tui-no-data v-else style="margin-top: 300rpx;" :imgUrl="imgConfig + 'images/mall/my_course_empty.png'">暂无物流轨迹~</tui-no-data>
	</view>
</template>

<script>
	const util = require("@/utils/util.js")
	export default {
		data() {
			return {
				imgConfig: util.domainImg,
				shippingNo: '',
				shippingName: '',
				mobile: '',
				
				expressList: [],
				expressStatus: 0, // 订单信息状态  1成功 2查询失败 3没有订单信息
			}
		},
		onLoad: function(options) {
			this.shippingNo = options.id
			this.shippingName = options.name
			this.mobile = options.mobile
		},
		onShow: function() {
			this.getList();
		},
		methods: {
			getList() {
				let that = this;
				util.request('order/queryLogistics', {
					billNo: that.shippingNo,
				}).then(function(res) {
					if (res.code === 0) {
						let info = res.data;
						that.expressList = info.list;
						that.expressStatus = info.status;
					}
				});
			}
		}
	}
</script>

<style>
	page {
		min-height: 100%;
		background-color: #f2f2f2;
	}
	.list_bg {
		padding: 20rpx 30rpx;
		overflow: hidden;
	}
	
	.top-sec {
		background-color: #FF9701;
		width: 100%;
		box-sizing: border-box;
		padding: 24rpx 30rpx;
		border-radius: 16rpx;
	}

	.top-sec .a-row {
		display: flex;
		font-size: 28rpx;
		line-height: 54rpx;
	}

	.top-sec .a-row .label {
		color: #fff;
		margin-right: 28rpx;
	}

	.top-sec .a-row .text {
		color: #fff;
		margin-right: 28rpx;
	}

	.wl-name {
		color: #fff;
		margin-right: 28rpx;
		font-size: 35rpx;
	}

	.sec-wrap {
		width: 100%;
		background-color: #fff;
		border-radius: 16rpx;
		font-size: 20rpx;
		padding-top: 30rpx;
	}

	.details-info {
		position: relative;
		width: 100%;
		overflow: hidden;
	}

	.details-info .a-row {
		margin-left: 40rpx;
		display: flex;
		margin-right: 30rpx;
		margin-bottom: 50rpx;
		position: relative;
		z-index: 4;
	}

	.details-info .a-row .info {
		width: 90%;
		font-size: 28rpx;
	}

	.date-box {
		font-size: 26rpx;
		color: #999;
		margin-bottom: 20rpx;
	}

	.info .text {
		color: #000;
		line-height: 42rpx;
	}

	.dot {
		width: 30rpx;
		height: 30rpx;
		margin-right: 30rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
	}

	.default-dot {
		background: #ddd;
		width: 15rpx;
		height: 15rpx;
		border-radius: 100%;
		margin-top: 10rpx;
	}

	.active-dot {
		border: 2rpx solid #FF9701;
		width: 26rpx;
		height: 26rpx;
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		background-color: #fff;
	}

	.active-dot .yuan-red {
		background: #FF9701;
		width: 15rpx;
		height: 15rpx;
		border-radius: 50%;
	}

	.line-box {
		position: absolute;
		top: -60rpx;
		left: 54rpx;
		background: #FF9701;
		width: 4rpx;
		height: 100%;
	}
</style>
